

*graph AMCEs
ssc install coefplot
coefplot (reg, keep( *.sex  *.religion  *.residence *.occupation *.education *.language *.friends  *.team_support *.children 1.country) pstyle(p1)) ///  
(Romania, rename ( (1) = R)  \ ///
country2, rename ( (1) = C)  \ ///
country4, rename ( (1) = P) \ ///
country5, rename ( (1) = S) pstyle(p1)) ///
(reg, keep (1.legal_status ) pstyle(p1)) ///
(legal, rename ( (1) = L) pstyle(p1)), ///
headings(1.sex = "{bf: Child gender}" 1.residence = "{bf: Parents' length of residence}" 1.occupation = "{bf: Parents' occupation}"  ///
1.education = "{bf: Parents' education}" 1.religion = "{bf: Parents' religion}" 1.language = "{bf: Parents' Italian proficiency}" 1.friends = "{bf: Family friends Origin}" 1.children = "{bf:Total number of children}" 1.team_support = "{bf:Parents' team support}" 1.country = "{bf: Parents' country of origin}" 1.legal_status = "{bf:Parents' legal status}") ///
xline (-0.4 -0.3 -0.2 -0.1 0.1 0.2, lstyle(grid)) xline (0, lpattern(dash)) ciopts(recast(rcap)) baselevels ///
coeflabels(    R = "Romania"  ///
               C = "China"  ///
               P = "Pakistan" ///
			   S = "Senegal"  ///
			   L = "Regular", labsize(vsmall)) msymbol(s) mfcolor(white)  offset(0.05) /// 
			  graphregion(margin(zero)) xlabel( -0.2 "-20" -0.1 "-10" 0 0.1 "10" 0.2 "20", valuelabel) xlabel(,labsize(small)) /// 
			    legend(off)   xtitle("Change in probability (perc. points)") graphregion(color(white)) xtitle(, size(small)) 	///
				order(*.occupation 1.legal_status L   *.residence  *.religion  *.language *.education *.friends  *.team_support *.children 1.country R C P S *.sex)
				graph export "Fig1_average.png", replace
				graph export "Fig1_average.eps", replace
				
est clear
